package com.lefevre.cms.bean.redEnvelope;

import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 收红包
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("receive_red_envelope")
@Entity
@Table(name = "receive_red_envelope", indexes = {@Index(name = "receive_red_envelope_1_idx", columnList = "receiveUserId,receiveTime")})
public class ReceiveRedEnvelope implements Serializable {
    private static final long serialVersionUID = 2312569666444084709L;

    /**
     * ID (结构：发红包Id_收红包的用户Id)
     **/
    @Id
    @Column(length = 80)
    @TableId(type = IdType.INPUT)
    protected String id;

    /**
     * 收红包的用户Id
     **/
    @TableField("receiveUserId")
    protected Long receiveUserId;

    /**
     * 收红包的用户名称
     **/
    @Transient
    @TableField(exist = false)
    protected String receiveUserName;

    /**
     * 收红包的用户呢称
     **/
    @Transient
    @TableField(exist = false)
    protected String receiveNickname;

    /**
     * 收红包的用户头像路径
     **/
    @Transient
    @TableField(exist = false)
    protected String receiveAvatarPath;

    /**
     * 收红包的用户头像名称
     **/
    @Transient
    @TableField(exist = false)
    protected String receiveAvatarName;

    /**
     * 发红包Id
     **/
    @Column(length = 32)
    @TableField("giveRedEnvelopeId")
    protected String giveRedEnvelopeId;

    /**
     * 发红包的用户Id
     **/
    @TableField("giveUserId")
    protected Long giveUserId;

    /**
     * 发红包的用户名称
     **/
    @Transient
    @TableField(exist = false)
    protected String giveUserName;

    /**
     * 发红包的用户呢称
     **/
    @Transient
    @TableField(exist = false)
    protected String giveNickname;
    /**
     * 发红包的用户头像路径
     **/
    @Transient
    @TableField(exist = false)
    protected String giveAvatarPath;
    /**
     * 发红包的用户头像名称
     **/
    @Transient
    @TableField(exist = false)
    protected String giveAvatarName;

    /**
     * 收取时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("receiveTime")
    protected Date receiveTime;

    /**
     * 红包金额
     **/
    @Column(precision = 12, scale = 2)
    @TableField(value = "amount", numericScale = "2")
    protected BigDecimal amount = new BigDecimal("0");

    /**
     * 版本号
     **/
    @Version
    protected Integer version = 0;

}
